package com.demo.day1


fun main() {
    println("开始")
    val intList: List<Int> = listOf(1, 2, 3)
    val intList2: MutableList<Int> = mutableListOf(1, 2, 3)
    val map: Map<String, Any> = mapOf("key" to "value", "age" to 20)
    val map2: MutableMap<String, Any> = mutableMapOf("key" to "value", "age" to 20)
    for (i in 0..10) {
        intList2 += i
    }
    println(intList[1])
    println(intList2.joinToString())
    intList2[2] = 10
    println(intList2.joinToString())
    val strList2: MutableList<String> = mutableListOf("a", "b", "c")
    for (i in 10 downTo 1) {
        strList2 += "num:$i"
    }
    println(strList2.joinToString())

    for (i in strList2.indices) {
        println(strList2[i])
    }

    strList2.forEachIndexed { i, str ->
        println("index:$i,value:$str")
    }
    strList2.forEachIndexed { i, str -> strList2[i] += "for" }
    println(strList2.joinToString())
}

